package com.ep.modules.app.controller;

import com.ep.common.annotation.SysLog;
import com.ep.common.utils.PageUtils;
import com.ep.common.utils.R;
import com.ep.common.validator.ValidatorUtils;
import com.ep.modules.app.entity.AppProductionMonitoring;
import com.ep.modules.app.service.AppProductionMonitoringService;
import java.util.Map;
import org.springframework.beans.factory.annotation.*;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/app/production_monitoring")
public class AppProductionMonitoringController {
    @Autowired
    private AppProductionMonitoringService appProductionMonitoringService;

    @GetMapping("/list")
    public R list(Map<String, Object> params) {
        PageUtils page = appProductionMonitoringService.queryPage(params);
        return R.ok().put("page", page);
    }

    @GetMapping("/info/{id}")
    public R info(@PathVariable Long id) {
        AppProductionMonitoring appproductionmonitoring = appProductionMonitoringService.getById(id);
        return R.ok().put("appproductionmonitoring", appproductionmonitoring);
    }

    @SysLog("保存AppProductionMonitoring")
    @PostMapping("/save")
    public R save(@RequestBody AppProductionMonitoring appproductionmonitoring) {
        ValidatorUtils.validateEntity(appproductionmonitoring);
        appProductionMonitoringService.save(appproductionmonitoring);
        return R.ok();
    }

    @SysLog("修改AppProductionMonitoring")
    @PostMapping("/update")
    public R update(@RequestBody AppProductionMonitoring appproductionmonitoring) {
        ValidatorUtils.validateEntity(appproductionmonitoring);
        appProductionMonitoringService.update(appproductionmonitoring);
        return R.ok();
    }

    @SysLog("删除AppProductionMonitoring")
    @PostMapping("/delete")
    public R delete(@RequestBody Long[] ids) {
        appProductionMonitoringService.deleteBatch(ids);
        return R.ok();
    }
}